﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameOfRobots
{
    public class InputController
    {
        private Robot _robot1;
        private Robot _robot2;

        public InputController(Robot robot)
        {
            if (robot == null)
                throw new ArgumentNullException("robot");

            _robot1 = robot;
        }
        public InputController(Robot robot, Robot robot2)
        {
            if (robot == null)
                throw new ArgumentNullException("robot");

            _robot1 = robot;
            _robot2 = robot;
        }

        public void Moving()
        {
            Renderer Go = new Renderer();
            ConsoleKeyInfo pressingButton = Console.ReadKey();

            if (pressingButton.Key == ConsoleKey.Spacebar)
            {
                _robot1.SetNextColor();
            }
            if (pressingButton.Key == ConsoleKey.UpArrow)
            {
                _robot1.GoUp();
            }
            if (pressingButton.Key == ConsoleKey.DownArrow)
            {
                _robot1.GoDown();
            }
            if (pressingButton.Key == ConsoleKey.RightArrow)
            {
                _robot1.GoRight();
            }
            if (pressingButton.Key == ConsoleKey.LeftArrow)
            {
                _robot1.GoLeft();
            }

            if (pressingButton.Key == ConsoleKey.W)
            {
                _robot2.GoUp();
            }
            if (pressingButton.Key == ConsoleKey.S)
            {
                _robot2.GoDown();
            }
            if (pressingButton.Key == ConsoleKey.D)
            {
                _robot2.GoRight();
            }
            if (pressingButton.Key == ConsoleKey.A)
            {
                _robot2.GoLeft();
            }
        }

    }
}
